package com.test.spring;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;

public class MyBeanPostProcessor implements BeanPostProcessor {

    //这两个方法是初始化前后执行的，比如afterpropertiesset或者init方法前后
    @Override
    public Object postProcessBeforeInitialization(Object o, String s) throws BeansException {
        System.out.println("Enter ProcessorBean.postProcessBeforeInitialization()");
        return o;
    }

    @Override
    public Object postProcessAfterInitialization(Object o, String s) throws BeansException {
        System.out.println("Enter ProcessorBean.postProcessAfterInitialization()\n");
        return o;
    }
}
